package timbap.visualizer.api.context.messaging;

import timbap.visualizer.api.model.TimeCode;

/**
 * The <code>TimeCodePublisher</code> interface is the base
 * interface for all classes publishing a time code.
 *
 * @author  Andreas Pabst
 * @see timbap.visualizer.api.model.TimeCode
 * @see timbap.visualizer.api.context.messaging.TimeCodeListener
 */
public interface TimeCodePublisher {
    
    /**
     * registers the time code listener.
     * 
     * There can only be one listener at a time,
     * so the previous listener is unregistered.
     * 
     * @param pTimeCodeListener	the newly registered time code listener 
     */
    public void setTimeCodeListener(TimeCodeListener pTimeCodeListener);
    
    /**
     * publishes the time code to the listener.
     * 
     * @param pTimeCode the time code
     */
    public void publishTimeCode(TimeCode pTimeCode);
    
    /**
     * determines if a time code is available
     * 
     * @return	true if a time code is available
     */
    public boolean hasTimeCode();

    /**
     * determines if the time code published is valid
     *
     * @return  true if the time code is valid
     */
    public boolean isTimeCodeValid();

    /**
     * determines if the time code published is stale
     *
     * @return  true if the time code is not fresh
     */
    boolean isTimeCodeStale();
}
